# Created by: Olivier Duchateau
# $FreeBSD$

PORTNAME=	scratch
PORTVERSION=	2.0.2
CATEGORIES=	editors
MASTER_SITES=	https://launchpadlibrarian.net/157950366/ \
	https://launchpad.net/${PORTNAME}/2.x/${PORTVERSION}/+download/
EXTRACT_SUFX=	.tgz

MAINTAINER=	olivierd@FreeBSD.org
COMMENT=	Lightweight and simple text editor

LICENSE=	GPLv3
LICENSE_FILE=	${WRKSRC}/COPYING

BUILD_DEPENDS=	valac:${PORTSDIR}/lang/vala
LIB_DEPENDS=	libgee-0.8.so:${PORTSDIR}/devel/libgee \
	libpeas-1.0.so:${PORTSDIR}/devel/libpeas \
	libsoup-2.4.so:${PORTSDIR}/devel/libsoup \
	libzeitgeist-1.0.so:${PORTSDIR}/sysutils/libzeitgeist \
	libgtkspell3-3.so:${PORTSDIR}/textproc/gtkspell3
RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}chardet>=2.2.1:${PORTSDIR}/textproc/py-chardet \
	zeitgeist-daemon:${PORTSDIR}/sysutils/zeitgeist

USES=	cmake pkgconfig gettext desktop-file-utils
USE_GNOME=	glib20 gtk30 gtksourceview3 introspection:build
USE_PYTHON=	yes
GLIB_SCHEMAS=	org.pantheon.scratch.gschema.xml \
	org.pantheon.scratch.plugins.file-manager.gschema.xml \
	org.pantheon.scratch.plugins.folder-manager.gschema.xml

REINPLACE_ARGS=	-i ""

post-patch:
# Use the latest libgee API
	@${REINPLACE_CMD} 's|gee-1.0|gee-0.8|' \
		${WRKSRC}/src/scratchcore.deps
	@${FIND} ${WRKSRC}/plugins -type f -name 'CMakeLists.txt' \
		| ${XARGS} ${REINPLACE_CMD} \
		's|gee-1.0|gee-0.8|'
# Disable all plugins, because 'libpeas-gtk-1.0.vapi' embed is higher than ours
#	@${REINPLACE_CMD} 's|add_subdirectory (plugins)|#add_subdirectory (plugins)|' \
#		${WRKSRC}/CMakeLists.txt

.include <bsd.port.mk>
